package com.logic.config.interceptor;

import com.logic.comment.util.JwtUtils;
import com.logic.modular.game.player.fish.service.PlayerFishServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Slf4j
@Service
public class ServiceInterceptor {
    @Resource
    private PlayerFishServiceImpl playerFishService;

    public void apply(HttpServletRequest request) {
        String url = request.getRequestURI();
        String token = request.getHeader("token");
        Long playerId = JwtUtils.getPlayerId(token);
        playerFishService.actionCheck(playerId, url);
    }
}
